'''
Created on 08/04/2011

@author: eric
'''

from urllib2 import Request, urlopen, URLError, HTTPError
class Get:
    
    @staticmethod
    def page(URL):
        '''
        Do the connection
        @param URL:
        '''
        req = Request(URL)
        ret = ""
        try:
            response = urlopen(req)
            ret = response.read()
        except HTTPError, e:
            print 'The server couldn\'t fulfill the request.'
            print 'Error code: ', e.code
        except URLError, e:
            print 'We failed to reach a server.'
            print 'Reason: ', e.reason
        except:
            print 'For some reason i cannot fetch the page.'
        return ret
        